package cn.iocoder.yudao.module.member.dal.mysql.companytemplate;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.controller.app.companytemplate.vo.CompanyTemplatePageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.companytemplate.CompanyTemplateDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 会员公司信息模板 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CompanyTemplateMapper extends BaseMapperX<CompanyTemplateDO> {

    default PageResult<CompanyTemplateDO> selectPage(CompanyTemplatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CompanyTemplateDO>()
                .likeIfPresent(CompanyTemplateDO::getCompanyName, reqVO.getCompanyName())
                .eqIfPresent(CompanyTemplateDO::getCompanyLicenseNumber, reqVO.getCompanyLicenseNumber())
                .likeIfPresent(CompanyTemplateDO::getLegalName, reqVO.getLegalName())
                .eqIfPresent(CompanyTemplateDO::getIdCard, reqVO.getIdCard())
                .eqIfPresent(CompanyTemplateDO::getPhone, reqVO.getPhone())
                .eqIfPresent(CompanyTemplateDO::getEmail, reqVO.getEmail())
                .eqIfPresent(CompanyTemplateDO::getIdPositive, reqVO.getIdPositive())
                .eqIfPresent(CompanyTemplateDO::getIdNegative, reqVO.getIdNegative())
                .eqIfPresent(CompanyTemplateDO::getLicense, reqVO.getLicense())
                .betweenIfPresent(CompanyTemplateDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CompanyTemplateDO::getId));
    }

}